package com.moetube.user.service.impl;


import com.moetube.user.dao.CollectMapper;
import com.moetube.user.pojo.Collect;
import com.moetube.user.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollectServiceImpl implements CollectService {
    @Autowired
    private CollectMapper collectMapper;
    @Override
    public List<Collect> findAll() {
        List<Collect> collectList = collectMapper.selectAll();
        return collectList;
    }

    @Override
    public Collect findById(Long id) {
        Collect collect = collectMapper.selectByPrimaryKey(id);
        return collect;
    }

    @Override
    public void add(Collect collect) {
        collectMapper.insert(collect);
    }

    @Override
    public void update(Collect collect) {
        collectMapper.updateByPrimaryKey(collect);
    }

    @Override
    public void delete(Long id) {
        collectMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<Collect> findCollectsListByUserId(String userId) {
        return collectMapper.findCollectsByUserId(userId);
    }


}
